package com.wondream.dao;

import com.wondream.domain.Article;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Date;
import java.util.List;

/**
 * @author wondream
 * @version 1.0
 * @create 2022/5/12 6:08 AM
 */
public interface ArticleDao extends JpaRepository<Article, Integer>, JpaSpecificationExecutor<Article> {
    // 根据标题查询
    List<Article> findByTitle(String title);
    // 根据标题模糊查询
    List<Article> findByTitleLike(String title);
    // 根据标题和作者查询
    List<Article> findByTitleAndAuthor(String title, String author);
    // 根据ID范围查询 LessThan GreaterThan Between In
    List<Article> findByAidBetween(Integer start, Integer end);
    // 在列表中 In
    List<Article> findByAidIn(List<Integer> aidList);
    // 根据创建时间之后查询
    List<Article> findByCreateTimeAfter(Date date);
}
